package com.sen.uaa.config;

import com.sen.uaa.service.UserServiceImpl;
import org.springframework.security.config.annotation.SecurityConfigurerAdapter;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.web.DefaultSecurityFilterChain;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * ca安全配置
 * @author esjiang
 */
@Component
public class CaAuthenticationSecurityConfig extends SecurityConfigurerAdapter<DefaultSecurityFilterChain, HttpSecurity> {

    @Resource
    UserServiceImpl userService ;
    @Override
    public void configure(HttpSecurity builder) {
        CaAuthenticationProvider caAuthenticationProvider = new CaAuthenticationProvider();
        caAuthenticationProvider.setUserDetailsService(userService);
        builder.authenticationProvider(caAuthenticationProvider) ;
    }
}
